home *** CD-ROM | disk | FTP | other *** search
/ Isometric Game Programming with DirectX 7.0 / Isometric Game Programming.iso / directx / dxf / samples / multimedia / common / include / dmutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-04  |  4.3 KB  |  126 lines

  1. //-----------------------------------------------------------------------------
  2. // File: DMUtil.h
  3. //
  4. // Desc: 
  5. //
  6. // Copyright (c) 1999-2000 Microsoft Corp. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #ifndef DMUTIL_H
  9. #define DMUTIL_H
  10.  
  11. #include <dmusicc.h>
  12. #include <dmusici.h>
  13. #include <dsound.h>
  14.  
  15.  
  16. //-----------------------------------------------------------------------------
  17. // Classes used by this header
  18. //-----------------------------------------------------------------------------
  19. class CMusicManager;
  20. class CMusicSegment;
  21. class CMusicScript;
  22.  
  23.  
  24.  
  25.  
  26. //-----------------------------------------------------------------------------
  27. // Name: class CMusicManager
  28. // Desc: 
  29. //-----------------------------------------------------------------------------
  30. class CMusicManager
  31. {
  32. protected:
  33.     IDirectMusicLoader8*      m_pLoader;
  34.     IDirectMusicPerformance8* m_pPerformance;
  35.  
  36. public:
  37.     CMusicManager();
  38.     ~CMusicManager();
  39.  
  40.     inline IDirectMusicLoader8*      GetLoader()      { return m_pLoader; }
  41.     inline IDirectMusicPerformance8* GetPerformance() { return m_pPerformance; }
  42.     IDirectMusicAudioPath8* GetDefaultAudioPath();
  43.  
  44.     HRESULT Initialize( HWND hWnd, DWORD dwPChannels = 128, DWORD dwDefaultPathType = DMUS_APATH_SHARED_STEREOPLUSREVERB );
  45.  
  46.     HRESULT SetSearchDirectory( const TCHAR* strMediaPath );
  47.     VOID    CollectGarbage();
  48.  
  49.     HRESULT CreateSegmentFromFile( CMusicSegment** ppSegment, TCHAR* strFileName, 
  50.                                    BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
  51.     HRESULT CreateScriptFromFile( CMusicScript** ppScript, TCHAR* strFileName );
  52.  
  53.     HRESULT CreateChordMapFromFile( IDirectMusicChordMap8** ppChordMap, TCHAR* strFileName );
  54.     HRESULT CreateStyleFromFile( IDirectMusicStyle8** ppStyle, TCHAR* strFileName );
  55.     HRESULT GetMotifFromStyle( IDirectMusicSegment8** ppMotif, TCHAR* strStyle, TCHAR* wstrMotif );
  56.  
  57.     HRESULT CreateSegmentFromResource( CMusicSegment** ppSegment, TCHAR* strResource, TCHAR* strResourceType, 
  58.                                    BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
  59. };
  60.  
  61.  
  62.  
  63.  
  64. //-----------------------------------------------------------------------------
  65. // Name: class CMusicSegment
  66. // Desc: Encapsulates functionality of an IDirectMusicSegment
  67. //-----------------------------------------------------------------------------
  68. class CMusicSegment
  69. {
  70. protected:
  71.     IDirectMusicSegment8*     m_pSegment;
  72.     IDirectMusicLoader8*      m_pLoader;
  73.     IDirectMusicPerformance8* m_pPerformance;
  74.     IDirectMusicAudioPath8*   m_pEmbeddedAudioPath;
  75.     BOOL                      m_bDownloaded;
  76.  
  77. public:
  78.     CMusicSegment( IDirectMusicPerformance8* pPerformance, 
  79.                    IDirectMusicLoader8* pLoader,
  80.                    IDirectMusicSegment8* pSegment );
  81.     virtual ~CMusicSegment();
  82.  
  83.     inline  IDirectMusicSegment8* GetSegment() { return m_pSegment; }
  84.     HRESULT GetStyle( IDirectMusicStyle8** ppStyle, DWORD dwStyleIndex = 0 );
  85.  
  86.     HRESULT SetRepeats( DWORD dwRepeats );
  87.     HRESULT Play( DWORD dwFlags = DMUS_SEGF_BEAT, IDirectMusicAudioPath8* pAudioPath = NULL );
  88.     HRESULT Stop( DWORD dwFlags = DMUS_SEGF_BEAT );
  89.     HRESULT Download( IDirectMusicAudioPath8* pAudioPath = NULL );
  90.     HRESULT Unload( IDirectMusicAudioPath8* pAudioPath = NULL );
  91.  
  92.     BOOL    IsPlaying();
  93. };
  94.  
  95.  
  96.  
  97.  
  98. //-----------------------------------------------------------------------------
  99. // Name: class CMusicScript
  100. // Desc: Encapsulates functionality of an IDirectMusicScript
  101. //-----------------------------------------------------------------------------
  102. class CMusicScript
  103. {
  104. protected:
  105.     IDirectMusicScript8*      m_pScript;
  106.     IDirectMusicLoader8*      m_pLoader;
  107.     IDirectMusicPerformance8* m_pPerformance;
  108.  
  109. public:
  110.     CMusicScript( IDirectMusicPerformance8* pPerformance, 
  111.                   IDirectMusicLoader8* pLoader,
  112.                   IDirectMusicScript8* pScript );
  113.     virtual ~CMusicScript();
  114.  
  115.     inline  IDirectMusicScript8* GetScript() { return m_pScript; }
  116.  
  117.     HRESULT CallRoutine( TCHAR* strRoutine );
  118.     HRESULT SetVariableNumber( TCHAR* strVariable, LONG lValue );
  119.     HRESULT GetVariableNumber( TCHAR* strVariable, LONG* plValue );
  120. };
  121.  
  122.  
  123.  
  124.  
  125. #endif // DMUTIL_H
  126.